/*
* 浅度复制
* */
var extend = function(parent, child) {
    var i = null;
    child = child || {};
    for(i in parent) {
        if(parent.hasOwnProperty(i)) {
            child[i] = parent[i];
        }
    };
};
/*
* 深度复制
* */
var deepExtend = function(parent, child) {
    var i = null,
        toStr = Object.prototype.toString,                             // 判断属性是对象还是数组
        astr = "[object Array]";

    child = child || {};

    for(i in parent) {
        if(parent.hasOwnProperty(i)) {
            if(typeof parent[i] === "object") {
                child[i] = toStr.call(child[i]) === astr ? [] : {};
                deepExtend(parent[i], child[i]);
            }else {
                child[i] = parent[i];
            }
        }
    }

    return child;
};


/*
* 混合的复制对象模式，可以传入多个对象，将返回一个集合这几个对象所有属性的对象
* */

var mixExtend = function() {
    var args = null, prop = null, len = arguments.length, child = {};
    for(args = 0; args < len; args++) {
        deepExtend(arguments[args], child);
    }
    return child;
};